<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>洗衣机编码输入</title>
    <link href="css/swiper.min.css" rel="stylesheet"/>
    <link href="css/public.css" rel="stylesheet"/>
    <link href="css/main.css" rel="stylesheet"/>
    <link href="css/style.css" rel="stylesheet"/>

    <script src="./js/jquery-1.9.1.js"></script>

    <script src="js/mobile-util.js"></script>
    <script src="js/layer/layer.js"></script>
	<script src="js/public.js"></script>
	<script src="js/laydate.js"></script>
	<script src="./js/common.js"></script>
	<script src="../mifiadmin/js/common.js"></script>
	<style>
		.codebox{
			display: none;
			text-align: center;
			margin-top: 1rem;
			font-size: .6rem;
		}
		.codebox p{
			margin: .5rem 0;
		}
	</style>

</head>
<body>

<header class="mui-bar mui-bar-nav indexheader flex">
    <div class="headerlogo hide">
        <i class="iconfont backbtn">&#xe602;</i>
    </div>

    <div class="headertitle">
        <p>洗衣机编码</p>
    </div>

    <div class="headerright timeright hide">
        <p class="timepbox iconfont">&#xe6d9;</p>

    </div>

</header>


<main class="recordmain">

	<ul class="realui">
		<li class="flex">
			<div class="realright">
				<input type="number" placeholder="请输入洗衣机编码" id="equipment" style="height: 1.4rem">
			</div>
		</li>
	</ul>

	<!-- <div class="ma-speen-5">
		<input type="button" value="充值"  onclick="generate()"  class="rechargebtn">

		<input type="button" value="查询设备套餐"  onclick="getTrafficquery()"  class="rechargebtn" style="margin-top: .5rem;position: relative">
	</div>

	<div class="codebox">
		<p>设备二维码</p>
		<img src="" alt="" id="imgcode">
	</div> -->

</main>

</body>


<script>

function getTrafficquery(){
	var device_sn=$('#equipment').val();

	if(device_sn==""){
		alert("请输入设备号");
		return false;
	}else{
		window.location.href="trafficquery.html?device_sn="+device_sn;
	}
}


$("#equipment").keydown(function(event) {
	var reg = /^\d{32}$/;
	var value = $(this).val();
	var e = event || window.event || arguments.callee.caller.arguments[0];

	if(e.keyCode === 8) {
		return true;
	}

	if(e.keyCode == 32) {
		return false;
	}

	if(reg.test(value)) {
		return false;
	}

});

function generate(){
	var device_sn=$('#equipment').val();
	var urls= url + "/mobile/login.html?device_sn=";
	window.location.href= urls+device_sn;	
	// $.ajax({
	// 	type:"get",
	// 	url:url+"/login.html?device_sn="+device_sn,
	// 	success:function(data){

	// 		var data1=JSON.parse(data);
	// 		//console.log(data1);
	// 		var success=data1.success;
	// 		var error=data1.error;
	// 		if(success.code== 4008){
	// 			alert(success.message);
	// 			$('#equipment').focus();
	// 			$('.codebox').hide();
	// 			return false;
	// 		}

	// 		if(success.code== 4006){
	// 			alert(success.message);
	// 			$('#equipment').focus();
	// 			$('.codebox').hide();
	// 			return false;
	// 		}

	// 		if(success.code== 4000){
	// 			var Device=data1.Device;
	// 			$('#imgcode').attr("src",Device[0].QRcode);
	// 			$('.codebox').show();
	// 			return false;
	// 		}


	// 	},error:function(data){
	// 		alert("请检查您的网络！再重新获取");
	// 	}
	// })
}

</script>



</html>
